package com.h2cloud.workflow;

import lombok.Data;
import lombok.experimental.Accessors;

/**
 * @author: wulongkai
 * @create: 2022-11-28 17:29
 **/
public class Main2 {
    public static void main(String[] args) {
        father var;

        Main2 main2 = new Main2();
        father obj = main2.getObj();
        var = obj;

        var.fun0();
    }
    public father getObj(){
        son son = new son();
        son.setName("longkai");
        son.setAge(12);
        return son;
    }
}
@Data
@Accessors(chain = true)
abstract class father {
    String name;

    public void fun0(){
        fun();
    }

    abstract void fun();
}

@Data
@Accessors(chain = true)
class son extends father {
    Integer age;

    public void fun() {
        System.out.println("son fun");
    }
}

@Data
@Accessors(chain = true)
class son2 extends father {
    Integer age;

    public void fun() {
        System.out.println("son2 fun");
    }
}